﻿using System;
using System.Collections.Generic;
using System.Text;
//new
using HK;
using System.Drawing;

namespace JKZP
{
    public class HKCVR:JKCamera
    {
        public HKCVR()
        {
            m_Type = PP.JKCAMERATYPE.HAIKANG;
            m_Port = 8000;
            m_UserName = "admin";
            m_PassWord = "12345";
            Init();
        }
        public override void Init()
        {
            m_LoginID = -1;//海康-1代表失败
            m_Channel = 1;//通道从1开始
            m_PlayHandle = -1;//海康-1代表预览失败
            m_CamIsOpen = false;
            m_CDMC = "车道1";
            m_CDDM = "1";
            m_SnapCount = "3";
            m_TempPicName = "";
            m_FileName1 = "";
            m_FileName2 = "";
            m_FileName3 = "";
        }
        public override void Login()
        {
            CHCNetSDK.NET_DVR_DEVICEINFO_V30 struDeviceInfo = new CHCNetSDK.NET_DVR_DEVICEINFO_V30();
            m_LoginID = CHCNetSDK.NET_DVR_Login_V30(m_IP, m_Port, m_UserName, m_PassWord, ref struDeviceInfo);
        }
        public override void StartPreView(IntPtr handle)
        {
            if ((m_LoginID >= 0) && (handle != IntPtr.Zero))
            {
                CHCNetSDK.NET_DVR_CLIENTINFO lpClientInfo = new CHCNetSDK.NET_DVR_CLIENTINFO();
                lpClientInfo.lChannel = m_Channel;
                lpClientInfo.lLinkMode = 0x0000;
                lpClientInfo.sMultiCastIP = "";
                lpClientInfo.hPlayWnd = handle;
                m_PlayHandle = CHCNetSDK.NET_DVR_RealPlay_V30(m_LoginID, ref lpClientInfo, null, IntPtr.Zero, 1);//1--请求码流过程是否阻塞
                if (m_PlayHandle > 0) m_CamIsOpen = true;
            }
        }
        public override bool CaptureOnePic(string group,string index,JKCamera m_CurrentCam) {return false;}
        public override bool SaveOneGroup(string group){return false;}
        public override void StopPreView(){return;}
        public override void Logout()
        {
            if (m_LoginID >= 0) CHCNetSDK.NET_DVR_Logout_V30(m_LoginID);
            m_LoginID = -1;
        }
        public override void Left(int speed, bool stop){return;}
        public override void Right(int speed, bool stop){return;}
        public override void Up(int speed, bool stop){return;}
        public override void Down(int speed, bool stop){return;}
        public override void ZoomIn(int speed, bool stop){return;}
        public override void ZoomOut(int speed, bool stop){return;}
        public override void PTZ3D(Rectangle WinRect, Point pointStart, Point pointEnd){return;}
        public override void CallPreSetPoint(int index){return;}
        public override bool SavePreSetPoint(int index) { return false; }
        public override void ShutDown(){return;}
        public override void CheckTime(){return;}
        public override DateTime GetDeviceTime() { return DateTime.Now; }
        public override void Play(IntPtr handle){return;}
        public override void FindFile(DateTime from, DateTime to)
        {
            try
            {
                if (m_LoginID >= 0)
                {
                    //
                    CHCNetSDK.NET_DVR_FILECOND condition = new CHCNetSDK.NET_DVR_FILECOND();

                    int lFindHandle = CHCNetSDK.NET_DVR_FindFile_V30(m_LoginID, ref condition);

                }
            }
            catch { }
        }
        public override void StartPlayVideo(int index){return;}
        public override void StopPlayVideo(int index){return;}
        public override void PausePlayVideo(int index){return;}
        public override void FowardPlayVideo(int index){return;}
        public override void BackPlayVideo(int index){return;}
    }
}
